<?php
$cid=$_GET['c'];
$config=$this->config->item('img_size');
$noimg=$this->config->item('noimg');
$nocontent=$this->config->item('nocontent');
?>
<?php include_once 'inc_modules_path.php'; ?>

<h3>  <i class="fa fa-pencil"></i>  <?php echo $title; ?></h3>

<?php include_once 'inc_form_errors.php'; ?>

<div class="boxed">
	<?php echo form_open(site_urlc($this->class.'/edit'), array('class' => 'form-horizontal', 'id' => 'frm-edit')); ?>

		<input class="hide" type="text" id="p-title" name="title" value="<?php echo set_value('title',$seo['title']) ?>">
		<input class="hide" type="text" id="p-title_seo" name="title_seo" value="<?php echo set_value('title_seo',$seo['title_seo']) ?>">
		<input class="hide" type="text" id="p-tags" name="tags" value="<?php echo set_value('tags',$seo['tags']) ?>">
		<textarea class="hide" id='p-intro' name="intro" rows='8' class='span4'><?php echo set_value('intro',$seo['intro']) ?></textarea>

		<div class="boxed-inner seamless">

			<?php if(in_array($cid,array(23,24,30))): ?>
				<div class="control-group">
					<label class="control-label" for="title1">标题 </label>
					<div class="controls">
						<input type="text" id="title1" name="title1"  value="<?php echo set_value('title1',$it['title1']); ?>">
					</div>
				</div>
			<?php endif;?>
			<?php if($cid==30):?>
				<div class="control-group">
					<label class="control-label" for="ios_versions"> IOS版本号 </label>
					<div class="controls">
						<input type="text" id="ios_versions" name="ios_versions"  value="<?php echo set_value('ios_versions',$it['ios_versions']); ?>">
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="android_versions"> Android版本号 </label>
					<div class="controls">
						<input type="text" id="android_versions" name="android_versions"  value="<?php echo set_value('android_versions',$it['android_versions']); ?>">
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="is_update">是否强制更新</label>
					<div class="controls">
						是<input type="radio" name='is_update' value="1" <?php if(!empty($it['is_update']) && $it['is_update']==1):?> checked="checked"<?php endif;?>>
						否<input type="radio" name='is_update' value="0" <?php if(empty($it['is_update']) || $it['is_update']==0):?> checked="checked"<?php endif;?>>
					</div>
				</div>
				<div class="control-group">
					<label class="control-label" for="ios_url"> IOS下载链接 </label>
					<div class="controls">
						<input type="text" id="ios_url" name="ios_url"  value="<?php echo set_value('ios_url',$it['ios_url']); ?>">
					</div>
				</div>
			<?php endif;?>
			<?php if($cid==18): ?>
				<div class="control-group">
					<label class="control-label" for="tel"> 电话 </label>
					<div class="controls">
						<input type="text" id="tel" name="tel"  value="<?php echo set_value('tel',$it['tel']); ?>">
					</div>
				</div>
			<?php endif;?>
			<?php if($cid==11):?>
			<div class="control-group">
				<label class="control-label" for="social"> 缴纳社保额度 </label>
				<div class="controls">
					<input type="text" id="social" name="social"  value="<?php echo set_value('social',$it['social']); ?>">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="nosocial"> 未缴纳社保额度 </label>
				<div class="controls">
					<input type="text" id="nosocial" name="nosocial"  value="<?php echo set_value('nosocial',$it['nosocial']); ?>">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="worker"> 上班族额度 </label>
				<div class="controls">
					<input type="text" id="worker" name="worker"  value="<?php echo set_value('worker',$it['worker']); ?>">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="entrepreneur"> 企业主额度 </label>
				<div class="controls">
					<input type="text" id="entrepreneur" name="entrepreneur" value="<?php echo set_value('entrepreneur',$it['entrepreneur']); ?>">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="nohouse"> 无房 </label>
				<div class="controls">
					<input type="text" id="nohouse" name="nohouse"  value="<?php echo set_value('nohouse',$it['nohouse']); ?>">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="house"> 本人有房 </label>
				<div class="controls">
					<input type="text" id="house" name="house"  value="<?php echo set_value('house',$it['house']); ?>">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="relativehouse"> 亲戚有房 </label>
				<div class="controls">
					<input type="text" id="relativehouse" name="relativehouse"  value="<?php echo set_value('relativehouse',$it['relativehouse']); ?>">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="novehicle"> 本人名下无车 </label>
				<div class="controls">
					<input type="text" id="novehicle" name="novehicle"  value="<?php echo set_value('novehicle',$it['novehicle']); ?>">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="vehicle"> 本人名下有车 </label>
				<div class="controls">
					<input type="text" id="vehicle" name="vehicle"  value="<?php echo set_value('vehicle',$it['vehicle']); ?>">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="nochit"> 本人名下无保单 </label>
				<div class="controls">
					<input type="text" id="nochit" name="nochit" value="<?php echo set_value('nochit',$it['nochit']); ?>">
				</div>
			</div>
			<div class="control-group">
				<label class="control-label" for="chit"> 本人名下有保单 </label>
				<div class="controls">
					<input type="text" id="chit" name="chit"  value="<?php echo set_value('chit',$it['chit']); ?>">
				</div>
			</div>
			<?php endif;?>
			<?php if(!in_array($cid,$nocontent)):?>
			<div class="control-group uefull">
				<textarea id="editor_id" name="content" > <?php echo set_value('content',$it['content']); ?></textarea>
				<!-- <span class="help-inline"></span> -->
			</div>
			<?php endif;?>
			<?php if(!in_array($cid,$noimg)):?>
			<!-- 图片上传 -->
			<div class="control-group">
				<label for="img" class="control-label"><?php if($cid==30):?>安卓apk：<?php else:?>图片：<?php endif;?></label>
				<div class="controls">
					<div class="btn-group">
						<span class="btn btn-success">
							<i class="fa fa-upload"></i>
							<span> <?php echo lang('upload_file') ?> </span>
							<input class="fileupload" type="file" accept="" data-for="photo" multiple="multiple">
						</span>
						<input type="hidden" name="photo" class="form-upload" data-more="1" value="<?php echo $it['photo'] ?>">
						<input type="hidden" name="thumb" class="form-upload-thumb" value="<?php echo $it['thumb'] ?>">
					</div>
				</div>
			</div>

			<div id="js-photo-show" class="js-img-list-f">
				<!-- 模板 #tpl-img-list -->
			</div>

			<div class="clear"></div>
			<?php endif;?>
		</div>

		<div class="boxed-footer">
			<input type="hidden" name="cid" value="<?php echo $this->cid ?>">
			<input type="hidden" name="id" value="<?php echo $it['id']?>">
			<input type="submit" value="<?php echo lang('submit') ?>" class="btn btn-primary">
			<input type="reset" value="<?php echo lang('reset') ?>" class="btn btn-danger">
		</div>
	</form>
</div>

<?php include_once 'inc_ui_media.php'; ?>

<script type="text/javascript">
require(['jquery','adminer/js/ui','adminer/js/media'],function($,ui,media){
	ui.editor_create('editor_id');
	var page_photos = <?php echo json_encode(list_upload($it['photo'])) ?>;
	media.init();
	media.show(page_photos,'photo');
	media.sort('photo');
	$("#js-photo-show" ).sortable().disableSelection();
});
</script>
<?php //echo static_file('adminer/js/page.js'); ?>
